﻿using System;
using System.Collections.Generic;
using SuperX.SuperSocket.Client;
using SuperX.SuperSocket.Socket.Message;
using SuperSocket.SocketBase;

namespace SuperX.SuperSocket.Socket.Server
{
    public interface ISockectServer
    {
        event EventHandler<MessageArgs> MessageRecevied;

        event EventHandler<SocketErrorArgs> Error;

        event SessionHandler<Session, CloseReason> SessionClosed;

        event SessionHandler<Session> NewSessionConnected;

        bool Start();

        void Stop();

        void Send(string sessionId, byte[] datas);

        void Send(string sessionId, string content);

        void Send(string sessionId, string header, string content);

        void Send<T>(string sessionId, T obj) where T : new();

        void Broadcast<T>(T obj) where T : new();

        void Send(string sessionId, byte[] datas, Dictionary<string, string> headers);

        void Send(string sessionId, string content, Dictionary<string, string> headers);
    }
}